package pentago.engine;

import org.newdawn.slick.Image;

public abstract class ClickableObject {

    protected int xPos, yPos;
    protected int width, height;
    protected Image img;

    protected GameEngine gameEngine;

    public ClickableObject(GameEngine gameEngine, int xPos, int yPos, Image img) {
	this.xPos = xPos;
	this.yPos = yPos;
	this.width = img.getWidth();
	this.height = img.getHeight();
	this.img = new Image(img.getTexture());
	this.gameEngine = gameEngine;
    }

    public abstract void executeClick(int xPos, int yPos, int button);

    protected boolean isClicked(int xPos, int yPos) {
	return xPos >= this.xPos && xPos <= this.xPos + width
		&& yPos >= this.yPos && yPos <= this.yPos + height;
    }

    public Image getImg() {
	return img;
    }
}
